package com.hd.listener;

import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import com.hd.entity.sys.User;
import com.hd.event.UserEvent;
import com.hd.service.sys.RoleService;
import com.hd.util.JsonUtil;
@Component
public class UserListener{
	@Autowired
	private RoleService roleService;
	@EventListener
	public void doExecute(UserEvent event) {
		User user=event.getUser();
		Map<String, Set<String>> resources = roleService.selectResourceMapByUserId(user.getId());
		System.out.println(JsonUtil.toJson(resources));
		System.out.println("userListener:"+user.toString());
	}

}
